

import { BaseComponent } from "../../../../../extensions/cocos-scaffold-3x/assets/ui/base/BaseComponent";
import GpDamageLabelMaker from "./GpDamageLabelMaker";
export class GpDamageLabelProp {
    constructor(
        public maker: GpDamageLabelMaker,
        public damage: number
    ) { }
}
import { _decorator, Component, Label, Node, tween, v3 } from 'cc';
const { ccclass, property } = _decorator;
@ccclass
export default class GpDamageLabel extends BaseComponent<GpDamageLabelProp> {
    static path = "gameplay/v/damage/GpDamageLabel";

    @property(Label)
    label: Label = null;

    onInit() {
        this.label.string = "-" + this.prop.damage
        this.node.scale = v3(0, 0, 0)
        const targetX = this.node.position.x + (Math.random() * 50 - 25)
        const targetY = this.node.position.y + 50 + (Math.random() * 50 - 25)

        tween(this.node).to(0.3, { scale:  v3(1.2, 1.2, 1.2),position: v3(targetX, targetY, 0)  }).to(0.5, { scale: v3(0.8, 0.8, 0.8) }).call(() => {
            this.prop.maker.nodePoolMap.backNode(this.node, GpDamageLabel.path)
        }).start()
    }

    // update (dt) {}
}
